﻿namespace ExamV5
{
    using System;
    using System.Configuration;
    using System.Data;
    using System.Data.SqlClient;
    using System.Drawing;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using Wuqi.Webdiyer;

    public class FrmUserExamList : Page
    {
        protected GridView DataGridInfo;
        protected HtmlForm Form1;
        protected HtmlHead Head1;
        private HttpCookie httpCookie_0 = null;
        private HttpCookie httpCookie_1 = null;
        private HttpCookie httpCookie_2 = null;
        private HttpCookie httpCookie_3 = null;
        protected Label labRescordCount;
        protected LinkButton LBFirstPage;
        protected LinkButton LBLastPage;
        protected LinkButton LBNextPage;
        protected LinkButton LBPrevPage;
        private PublicFun publicFun_0 = new PublicFun();

        protected AspNetPager aspPager;
        protected ScriptManager SM;
        protected UpdatePanel UPPart;
        protected void DataGridInfo_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            this.DataGridInfo.PageIndex = e.NewPageIndex;
            this.method_0();
        }

        protected void DataGridInfo_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            //if (e.Row.DataItemIndex != -1)
            //{
            //    e.Row.Attributes.Add("onmouseover", "this.bgColor='#F6F5F5'");
            //    if ((e.Row.DataItemIndex % 2) != 0)
            //    {
            //        e.Row.Attributes.Add("bgcolor", "#FFFFFF");
            //        e.Row.Attributes.Add("onmouseout", "this.bgColor=document.getElementById('DataGridInfo').getAttribute('oldValue')");
            //    }
            //    else
            //    {
            //        e.Row.Attributes.Add("bgcolor", "#FFFFFF");
            //        e.Row.Attributes.Add("onmouseout", "this.bgColor=document.getElementById('DataGridInfo').getAttribute('singleValue')");
            //    }
            //}
            //else
            //{
            //    this.DataGridInfo.Attributes.Add("oldValue", "#FFFFFF");
            //    this.DataGridInfo.Attributes.Add("singleValue", "#FFFFFF");
            //}
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                if (e.Row.Cells[0].Text.Length > Convert.ToInt32(this.ViewState["SubStrLen"].ToString()))
                {
                    e.Row.Cells[0].Text = "<a title='" + e.Row.Cells[0].Text + "'>" + e.Row.Cells[0].Text.Substring(0, Convert.ToInt32(this.ViewState["SubStrLen"].ToString())) + "…</a>";
                }
                if (e.Row.Cells[1].Text.Length > 10)
                {
                    e.Row.Cells[1].Text = "<a title='" + e.Row.Cells[1].Text + "'>" + e.Row.Cells[1].Text.Substring(0, 10) + "…</a>";
                }
                e.Row.Cells[3].Text = e.Row.Cells[3].Text + "分钟";
                Label label2 = (Label) e.Row.Cells[5].FindControl("labWaring");
                label2.Text = "<a href='#' title='单击查看考试注意事项' onclick=javascript:ShowWarningInfo(false)><font color='blue'>注意事项</font></a>";
                LinkButton button = (LinkButton) e.Row.Cells[7].FindControl("LBSubmit");
                button.Enabled = false;
                button.ForeColor = Color.Gray;
                Label label = (Label) e.Row.Cells[6].FindControl("labEnter");
                if (this.DataGridInfo.DataKeys[e.Row.RowIndex]["Flag"].ToString() == "B")
                {
                    label.Enabled = false;
                    label.Text = "<a title='试卷有效期：" + this.DataGridInfo.DataKeys[e.Row.RowIndex]["PaperStartTime"].ToString() + "--" + this.DataGridInfo.DataKeys[e.Row.RowIndex]["PaperEndTime"].ToString() + "'>正在考试中</a>";
                    button.Enabled = true;
                    button.ForeColor = Color.Red;
                    button.Attributes.Add("onclick", @"javascript:{if(confirm('如果您未答完试题非法离开考场,找管理员设置重考,请勿交卷,单击[取消]按钮\n\n\n如果您是交卷未成功或失败,单击[确认]按钮进行强行交卷\n\n\n\n请再次确认您的操作,以免影响您的考试成绩？')==false) return false;}");
                }
                if (this.DataGridInfo.DataKeys[e.Row.RowIndex]["Flag"].ToString() == "G")
                {
                    label.Enabled = false;
                    label.Text = "<a title='试卷有效期：" + this.DataGridInfo.DataKeys[e.Row.RowIndex]["PaperStartTime"].ToString() + "--" + this.DataGridInfo.DataKeys[e.Row.RowIndex]["PaperEndTime"].ToString() + "'>正在考试中</a>";
                    button.Attributes.Add("onclick", @"javascript:{if(confirm('如果您未答完试题非法离开考场,找管理员设置重考,请勿交卷,单击[取消]按钮\n\n\n如果您是交卷未成功或失败,单击[确认]按钮进行强行交卷\n\n\n\n请再次确认您的操作,以免影响您的考试成绩？')==false) return false;}");
                    button.Enabled = true;
                    button.ForeColor = Color.Red;
                }
                if (this.DataGridInfo.DataKeys[e.Row.RowIndex]["IsSave"].ToString() == "0")
                {
                    DateTime time2 = Convert.ToDateTime(this.DataGridInfo.DataKeys[e.Row.RowIndex]["PaperStartTime"].ToString());
                    DateTime time = Convert.ToDateTime(this.DataGridInfo.DataKeys[e.Row.RowIndex]["PaperEndTime"].ToString());
                    if (DateTime.Now < time2)
                    {
                        label.Enabled = false;
                        label.Text = "<a title='试卷有效期：" + this.DataGridInfo.DataKeys[e.Row.RowIndex]["PaperStartTime"].ToString() + "--" + this.DataGridInfo.DataKeys[e.Row.RowIndex]["PaperEndTime"].ToString() + "'>考试时间未到</a>";
                    }
                    if (DateTime.Now > time)
                    {
                        label.Enabled = false;
                        label.Text = "<a title='试卷有效期：" + this.DataGridInfo.DataKeys[e.Row.RowIndex]["PaperStartTime"].ToString() + "--" + this.DataGridInfo.DataKeys[e.Row.RowIndex]["PaperEndTime"].ToString() + "'>考试时间过期</a>";
                    }
                    if (this.DataGridInfo.DataKeys[e.Row.RowIndex]["StudyPlanID"].ToString() != "0")
                    {
                        string values = this.publicFun_0.GetValues("select c.CountTime/(a.StudyLongTime*60) as CountStudy from StudyPlanInfo a,StudyUser c  where c.UserCode='" + this.httpCookie_0.Value + "' and c.PlanID=a.ID and a.ID=" + this.publicFun_0.CheckString(this.DataGridInfo.DataKeys[e.Row.RowIndex]["StudyPlanID"].ToString()), "CountStudy");
                        if (values.Trim() == "")
                        {
                            values = "0";
                        }
                        if (Convert.ToDouble(values) < 1.0)
                        {
                            label.Enabled = false;
                            string str6 = this.publicFun_0.GetValues("select PlanName from StudyPlanInfo where ID=" + this.publicFun_0.CheckString(this.DataGridInfo.DataKeys[e.Row.RowIndex]["StudyPlanID"].ToString()), "PlanName");
                            label.Text = "<a title='学习任务名称:" + str6 + "'>学习任务未完成</a>";
                        }
                    }
                }
                string userIP = Convert.ToString(base.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]);
                string startIP = this.DataGridInfo.DataKeys[e.Row.RowIndex]["StartIP"].ToString();
                string endIP = this.DataGridInfo.DataKeys[e.Row.RowIndex]["EndIP"].ToString();
                if (!(!(userIP == "") ? (userIP != null) : false))
                {
                    userIP = Convert.ToString(base.Request.ServerVariables["REMOTE_ADDR"]);
                }
                if (!this.publicFun_0.CheckIP(userIP, startIP, endIP))
                {
                    label.Enabled = false;
                    label.Text = "IP限制入考场";
                }
                if (label.Enabled)
                {
                    label.Text = "<a href='#' title='试卷有效期：" + this.DataGridInfo.DataKeys[e.Row.RowIndex]["PaperStartTime"].ToString() + "--" + this.DataGridInfo.DataKeys[e.Row.RowIndex]["PaperEndTime"].ToString() + "'  onclick=\"javascript:ShowJoinExam('" + this.DataGridInfo.DataKeys[e.Row.RowIndex]["IsSave"].ToString() + "','" + this.DataGridInfo.DataKeys[e.Row.RowIndex]["ID"].ToString() + "','" + this.DataGridInfo.DataKeys[e.Row.RowIndex]["OutPutType"].ToString() + "');\"><font color=red><B>进入考场</B></font></a>";
                }
            }
            if (e.Row.RowType == DataControlRowType.Header)
            {
                string str;
                if (!(this.ViewState["SortType"].ToString() == " Desc"))
                {
                    str = this.ViewState["SortFiled"].ToString();
                    if (str != null)
                    {
                        if (str == "ExamName")
                        {
                            e.Row.Cells[0].Controls.Add(new LiteralControl("↓"));
                            return;
                        }
                        if (str == "SubjectName")
                        {
                            e.Row.Cells[1].Controls.Add(new LiteralControl("↓"));
                            return;
                        }
                        if (str == "PaperFen")
                        {
                            e.Row.Cells[2].Controls.Add(new LiteralControl("↓"));
                            return;
                        }
                        if (str == "ExamTime")
                        {
                            e.Row.Cells[3].Controls.Add(new LiteralControl("↓"));
                            return;
                        }
                        if (str == "MemberFen")
                        {
                            e.Row.Cells[4].Controls.Add(new LiteralControl("↓"));
                            return;
                        }
                    }
                    e.Row.Cells[0].Controls.Add(new LiteralControl("↓"));
                    return;
                }
                str = this.ViewState["SortFiled"].ToString();
                switch (str)
                {
                    case null:
                        goto Label_0B89;

                    case "ExamName":
                        e.Row.Cells[0].Controls.Add(new LiteralControl("↑"));
                        return;

                    case "SubjectName":
                        e.Row.Cells[1].Controls.Add(new LiteralControl("↑"));
                        return;

                    case "PaperFen":
                        e.Row.Cells[2].Controls.Add(new LiteralControl("↑"));
                        return;
                }
                if (str == "ExamTime")
                {
                    e.Row.Cells[3].Controls.Add(new LiteralControl("↑"));
                }
                else
                {
                    if (!(str == "MemberFen"))
                    {
                        goto Label_0B89;
                    }
                    e.Row.Cells[4].Controls.Add(new LiteralControl("↑"));
                }
            }
            return;
        Label_0B89:
            e.Row.Cells[0].Controls.Add(new LiteralControl("↑"));
        }

        protected void DataGridInfo_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            string str = this.publicFun_0.CheckString(this.DataGridInfo.DataKeys[e.RowIndex]["ID"].ToString());
            string str2 = this.publicFun_0.CheckString(this.DataGridInfo.DataKeys[e.RowIndex]["ExamName"].ToString());
            string str3 = DateTime.Now.Hour.ToString() + ":" + DateTime.Now.Minute.ToString() + ":" + DateTime.Now.Second.ToString();
            string str4 = "E";
            double num2 = 0.0;
            SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
            connection.Open();
            SqlCommand command = new SqlCommand("select RubricSFen,RubricDFen,RubricBFen,RubricFFen,RubricAFen,RubricCFen,RubricTFen,RubricANFen,RubricOFen,RubricJFen from CheckPaper where UserCode='" + this.httpCookie_0.Value + "' and PaperID='" + str + "'", connection);
            SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
            if (!reader.Read())
            {
                this.publicFun_0.ExecuteSql("update ExamUser set GetOldCountFen=0,GetCountFen=0,Flag='E',EndTime='" + str3 + "',LastDate='" + DateTime.Now.ToShortDateString() + "' where UserCode='" + this.httpCookie_0.Value + "' and PaperID='" + str + "';insert into SysLogInfo(LogDisp,EditUser,EditUserCode) values('考生自己强行交卷[" + str2 + "]！','" + this.httpCookie_1.Value + "','" + this.httpCookie_0.Value + "')");
            }
            else
            {
                int num4;
                if (((((reader["RubricAFen"].ToString().Trim() != "") || (reader["RubricCFen"].ToString().Trim() != "")) || ((reader["RubricTFen"].ToString().Trim() != "") || (reader["RubricANFen"].ToString().Trim() != ""))) || ((reader["RubricOFen"].ToString().Trim() != "") || (reader["RubricJFen"].ToString().Trim() != ""))) || (reader["RubricFFen"].ToString().Trim() != ""))
                {
                    str4 = "D";
                }
                else
                {
                    str4 = "E";
                }
                if (reader["RubricSFen"].ToString().Trim() != "")
                {
                    string[] strArray11 = reader["RubricSFen"].ToString().Trim().Split(new char[] { '|' });
                    for (num4 = 0; num4 < strArray11.Length; num4++)
                    {
                        if (strArray11[num4].Trim() != "")
                        {
                            num2 += Convert.ToDouble(strArray11[num4].Trim());
                        }
                    }
                }
                if (reader["RubricDFen"].ToString().Trim() != "")
                {
                    string[] strArray10 = reader["RubricDFen"].ToString().Trim().Split(new char[] { '|' });
                    for (num4 = 0; num4 < strArray10.Length; num4++)
                    {
                        if (strArray10[num4].Trim() != "")
                        {
                            num2 += Convert.ToDouble(strArray10[num4].Trim());
                        }
                    }
                }
                if (reader["RubricBFen"].ToString().Trim() != "")
                {
                    string[] strArray9 = reader["RubricBFen"].ToString().Trim().Split(new char[] { '|' });
                    for (num4 = 0; num4 < strArray9.Length; num4++)
                    {
                        if (strArray9[num4].Trim() != "")
                        {
                            num2 += Convert.ToDouble(strArray9[num4].Trim());
                        }
                    }
                }
                if (reader["RubricFFen"].ToString().Trim() != "")
                {
                    string[] strArray8 = reader["RubricFFen"].ToString().Trim().Split(new char[] { '|' });
                    for (num4 = 0; num4 < strArray8.Length; num4++)
                    {
                        if (strArray8[num4].Trim() != "")
                        {
                            num2 += Convert.ToDouble(strArray8[num4].Trim());
                        }
                    }
                }
                if (reader["RubricAFen"].ToString().Trim() != "")
                {
                    string[] strArray7 = reader["RubricAFen"].ToString().Trim().Split(new char[] { '|' });
                    for (num4 = 0; num4 < strArray7.Length; num4++)
                    {
                        if (strArray7[num4].Trim() != "")
                        {
                            num2 += Convert.ToDouble(strArray7[num4].Trim());
                        }
                    }
                }
                if (reader["RubricCFen"].ToString().Trim() != "")
                {
                    string[] strArray6 = reader["RubricCFen"].ToString().Trim().Split(new char[] { '|' });
                    for (num4 = 0; num4 < strArray6.Length; num4++)
                    {
                        if (strArray6[num4].Trim() != "")
                        {
                            num2 += Convert.ToDouble(strArray6[num4].Trim());
                        }
                    }
                }
                if (reader["RubricANFen"].ToString().Trim() != "")
                {
                    string[] strArray5 = reader["RubricANFen"].ToString().Trim().Split(new char[] { '|' });
                    for (num4 = 0; num4 < strArray5.Length; num4++)
                    {
                        if (strArray5[num4].Trim() != "")
                        {
                            num2 += Convert.ToDouble(strArray5[num4].Trim());
                        }
                    }
                }
                if (reader["RubricTFen"].ToString().Trim() != "")
                {
                    string[] strArray4 = reader["RubricTFen"].ToString().Trim().Split(new char[] { '|' });
                    for (num4 = 0; num4 < strArray4.Length; num4++)
                    {
                        if (strArray4[num4].Trim() != "")
                        {
                            num2 += Convert.ToDouble(strArray4[num4].Trim());
                        }
                    }
                }
                if (reader["RubricOFen"].ToString().Trim() != "")
                {
                    string[] strArray3 = reader["RubricOFen"].ToString().Trim().Split(new char[] { '|' });
                    for (num4 = 0; num4 < strArray3.Length; num4++)
                    {
                        if (strArray3[num4].Trim() != "")
                        {
                            num2 += Convert.ToDouble(strArray3[num4].Trim());
                        }
                    }
                }
                if (reader["RubricJFen"].ToString().Trim() != "")
                {
                    string[] strArray2 = reader["RubricJFen"].ToString().Trim().Split(new char[] { '|' });
                    for (num4 = 0; num4 < strArray2.Length; num4++)
                    {
                        if (strArray2[num4].Trim() != "")
                        {
                            num2 += Convert.ToDouble(strArray2[num4].Trim());
                        }
                    }
                }
                this.publicFun_0.ExecuteSql(string.Concat(new object[] { 
                    "update ExamUser set GetOldCountFen=", num2, ",GetCountFen=", num2, ",Flag='", str4, "',EndTime='", str3, "',LastDate='", DateTime.Now.ToShortDateString(), "' where UserCode='", this.httpCookie_0.Value, "' and PaperID='", str, "';insert into SysLogInfo(LogDisp,EditUser,EditUserCode) values('考生自己强行交卷[", str2, 
                    "]！','", this.httpCookie_1.Value, "','", this.httpCookie_0.Value, "')"
                 }));
            }
            reader.Close();
            command.Dispose();
            connection.Close();
            connection.Dispose();
            this.DataGridInfo.PageIndex = 0;
            double num3 = 0.0;
            string values = this.publicFun_0.GetValues(string.Concat(new object[] { "select StudyFen from GradeReule where PaperID=", str, " and (", num2, ">=MinValue  and ", num2, "<=MaxValue)" }), "StudyFen");
            if (values.Trim() == "")
            {
                values = "0";
            }
            num3 = Convert.ToDouble(values);
            this.publicFun_0.ExecuteSql(string.Concat(new object[] { "delete  UserStudyFen where UserCode='", this.httpCookie_0.Value, "' and ExamOrStudy='E' and Formtable='PaperInfo' and FormID=", str, ";insert into UserStudyFen(UserCode,ExamStudyName,StudyFen,Formtable,FormID,ExamOrStudy) values('", this.httpCookie_0.Value, "','", str2, "','", num3, "','PaperInfo','", str, "','E')" }));
            this.method_0();
            base.Response.Write(@"<script>alert('强行交卷操作成功！\n\n请到个人信息中心--我的成绩学分菜单中查看成绩！');</script>");
        }

        protected void DataGridInfo_Sorting(object sender, GridViewSortEventArgs e)
        {
            string sortExpression = e.SortExpression;
            if (!(this.ViewState["SortFiled"].ToString() == sortExpression))
            {
                this.ViewState["SortFiled"] = e.SortExpression;
            }
            else if (!(this.ViewState["SortType"].ToString() == " Desc"))
            {
                this.ViewState["SortType"] = " Desc";
            }
            else
            {
                this.ViewState["SortType"] = " ASC";
            }
            this.method_0();
        }

        protected void DataGridInfo_PreRender(object sender, EventArgs e)
        {
            // 使用<TH>替换<TD> 
            this.DataGridInfo.UseAccessibleHeader = true;
            //HeaderRow将被<thead>包裹，数据行将被<tbody>包裹
            this.DataGridInfo.HeaderRow.TableSection = TableRowSection.TableHeader;
        }

        protected void aspPager_PageChanged(object sender, EventArgs e)
        {
            this.DataGridInfo.PageIndex = this.aspPager.CurrentPageIndex - 1;
            this.method_0();
        }

        protected void LBFirstPage_Click(object sender, EventArgs e)
        {
            this.DataGridInfo.PageIndex = 0;
            this.method_0();
        }

        protected void LBLastPage_Click(object sender, EventArgs e)
        {
            if (this.DataGridInfo.PageCount > 0)
            {
                this.DataGridInfo.PageIndex = this.DataGridInfo.PageCount - 1;
                this.method_0();
            }
        }

        protected void LBNextPage_Click(object sender, EventArgs e)
        {
            if (this.DataGridInfo.PageIndex < (this.DataGridInfo.PageCount - 1))
            {
                this.DataGridInfo.PageIndex++;
                this.method_0();
            }
        }

        protected void LBPrevPage_Click(object sender, EventArgs e)
        {
            if (this.DataGridInfo.PageIndex > 0)
            {
                this.DataGridInfo.PageIndex--;
                this.method_0();
            }
        }

        private void method_0()
        {
            string selectCommandText = ("select b.StartIP,b.EndIP,b.StudyPlanID,b.OutPutType,b.MemberFen,a.IsSave,a.Flag,b.ID,b.ExamName,b.SubjectName,b.PaperFen,b.ExamTime,b.PaperStartTime,b.PaperEndTime from ExamUser a ,PaperInfo b  where a.ExamType='A' and (a.Flag='A' or a.Flag='B'  or a.Flag='G' ) and a.UserCode='" + this.httpCookie_0.Value.Trim() + "' and a.PaperID=b.ID and b.ISCheck='N' and b.PaperStatus='A' ") + " order by " + this.ViewState["SortFiled"].ToString() + this.ViewState["SortType"].ToString();
            SqlConnection selectConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
            SqlDataAdapter adapter = new SqlDataAdapter(selectCommandText, selectConnection);
            DataSet dataSet = new DataSet();
            adapter.Fill(dataSet, "DataInfo");
            this.DataGridInfo.DataSource = dataSet.Tables["DataInfo"].DefaultView;
            this.DataGridInfo.DataBind();
            //this.labRescordCount.Text = "总共&nbsp;<font color='#0000C0'><b>" + dataSet.Tables["DataInfo"].Rows.Count.ToString() + "</b></font>&nbsp;条记录&nbsp;<font color='#0000C0'><b>" + Convert.ToString((int) (this.DataGridInfo.PageIndex + 1)) + "/" + this.DataGridInfo.PageCount.ToString() + "</b></font>&nbsp;页&nbsp;";
            this.labRescordCount.Text = "总共&nbsp;<i>" + dataSet.Tables["DataInfo"].Rows.Count.ToString() + "</i>&nbsp;条记录&nbsp;<b>" + Convert.ToString((int)(this.DataGridInfo.PageIndex + 1)) + "/" + this.DataGridInfo.PageCount.ToString() + "</b>&nbsp;页&nbsp;";
            this.aspPager.RecordCount = dataSet.Tables["DataInfo"].Rows.Count;
            adapter.Dispose();
            selectConnection.Close();
            selectConnection.Dispose();
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            this.httpCookie_0 = new HttpCookie("ExamUserCode");
            this.httpCookie_0 = base.Request.Cookies["ExamUserCode"];
            this.httpCookie_1 = new HttpCookie("ExamUserName");
            this.httpCookie_1 = base.Request.Cookies["ExamUserName"];
            this.httpCookie_2 = new HttpCookie("ExamUserLevel");
            this.httpCookie_2 = base.Request.Cookies["ExamUserLevel"];
            this.httpCookie_3 = new HttpCookie("ExamDeptID");
            this.httpCookie_3 = base.Request.Cookies["ExamDeptID"];
            if (!((this.httpCookie_0 != null) ? !(this.httpCookie_0.Value == "") : false))
            {
                base.Response.Write("<script language=javascript>top.location.href='../Index.htm';self.close();</script>");
            }
            else
            {
                base.Response.Expires = 0;
                this.httpCookie_0.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_0.Value));
                this.httpCookie_1.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_1.Value));
                this.httpCookie_2.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_2.Value));
                this.httpCookie_3.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_3.Value));
                if (this.httpCookie_2.Value != "A")
                {
                    string str5 = base.Request.Url.ToString();
                    str5 = str5.Substring(0, str5.LastIndexOf('/') + 1);
                    base.Response.Redirect(str5 + "FrmManagExamList.aspx");
                }
                this.Page.Title = ConfigurationManager.ConnectionStrings["ProTitle"].ConnectionString;
                if (!base.IsPostBack)
                {
                    string str;
                    this.publicFun_0.ExecuteSql("delete from Systip where GetNumber='" + this.httpCookie_0.Value + "' and Formtable='PaperInfo'");
                    int num = Convert.ToInt32(ConfigurationManager.ConnectionStrings["OnlineNum"].ConnectionString);
                    if (num != 0)
                    {
                        string values = this.publicFun_0.GetValues("select Count(*) as CountNum from ExamUser where ExamType='A' and Flag='B'", "CountNum");
                        if (values.Trim() == "")
                        {
                            values = "0";
                        }
                        if (Convert.ToInt32(values) > num)
                        {
                            if (this.Session["IsTip"] == null)
                            {
                                base.Response.Write("<script>alert('此版本同时考试人数有限制(" + num.ToString() + "人)。人员已满,请稍后再试！')</script>");
                                this.Session["IsTip"] = "Y";
                            }
                            return;
                        }
                    }
                    this.ViewState["SortFiled"] = "ID";
                    this.ViewState["SortType"] = " Desc";
                    string str2 = this.publicFun_0.GetValues("select ParmValue from SysParmInfo where ParmMemo='SubStrLength'", "ParmValue").Trim();
                    if (str2.Trim() == "")
                    {
                        str2 = "20";
                    }
                    this.ViewState["SubStrLen"] = str2;
                    this.method_0();
                    if (this.publicFun_0.GetValues("select ParmValue from SysParmInfo where ParmMemo='DayRubric'", "ParmValue").Trim() == "Y")
                    {
                        if (this.publicFun_0.GetValues("select ID from DayRecored where UserCode='" + this.httpCookie_0.Value + "' and Convert(varchar(10),InputTime,120)=Convert(varchar(10),getdate(),120)", "ID") == "")
                        {
                            base.ClientScript.RegisterClientScriptBlock(this.Page.ClientScript.GetType(), "LoingScript", "ShowDayRubricInfo();", true);
                        }
                        else
                        {
                            str = this.publicFun_0.GetValues("select ParmValue from SysParmInfo where ParmMemo='ExamWarnShow'", "ParmValue").Trim();
                            if (str.Trim() == "")
                            {
                                str = "Y";
                            }
                            if (!((str.Trim() == "Y") ? (this.Session["IsShow"] != null) : true))
                            {
                                this.Session["IsShow"] = "Y";
                                base.ClientScript.RegisterClientScriptBlock(this.Page.ClientScript.GetType(), "LoingScript", "ShowWarningInfo(true);", true);
                            }
                        }
                    }
                    else
                    {
                        str = this.publicFun_0.GetValues("select ParmValue from SysParmInfo where ParmMemo='ExamWarnShow'", "ParmValue").Trim();
                        if (str.Trim() == "")
                        {
                            str = "Y";
                        }
                        if (!((str.Trim() == "Y") ? (this.Session["IsShow"] != null) : true))
                        {
                            this.Session["IsShow"] = "Y";
                            base.ClientScript.RegisterClientScriptBlock(this.Page.ClientScript.GetType(), "LoingScript", "ShowWarningInfo(true);", true);
                        }
                    }
                }
                else
                    ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "Render", "LayaUIFormRender();", true);
            }
        }
    }
}

